// Stata ML - 9 Cases Runner
// Run all 9 enterprise management cases

clear all
set more off

display "Stata ML - 9 Enterprise Management Cases"
display "=" * 80

local total_start = clock(c(current_time), "hms")

// Case 4: Data Quality Analysis
display ""
display "Case 4: Data Quality Analysis"
local start = clock(c(current_time), "hms")
capture noisily do "do/cases/case04_data_quality_analysis.do"
local dur = (clock(c(current_time), "hms") - `start') / 1000
display "Done! Time: " %5.1f `dur' " seconds"

// Case 5: Salary Analysis
display ""
display "Case 5: Salary Analysis"
local start = clock(c(current_time), "hms")
capture noisily do "do/cases/case05_salary_analysis.do"
local dur = (clock(c(current_time), "hms") - `start') / 1000
display "Done! Time: " %5.1f `dur' " seconds"

// Case 6: House Price Prediction
display ""
display "Case 6: House Price Prediction"
local start = clock(c(current_time), "hms")
capture noisily do "do/cases/case06_house_price_prediction.do"
local dur = (clock(c(current_time), "hms") - `start') / 1000
display "Done! Time: " %5.1f `dur' " seconds"

// Case 1: Employee Attrition
display ""
display "Case 1: Employee Attrition"
local start = clock(c(current_time), "hms")
capture noisily do "do/cases/case01_employee_attrition_data.do"
capture noisily do "do/cases/case01_employee_attrition_model.do"
local dur = (clock(c(current_time), "hms") - `start') / 1000
display "Done! Time: " %5.1f `dur' " seconds"

// Case 7: Credit Risk Assessment
display ""
display "Case 7: Credit Risk Assessment"
local start = clock(c(current_time), "hms")
capture noisily do "do/cases/case07_credit_risk_assessment.do"
local dur = (clock(c(current_time), "hms") - `start') / 1000
display "Done! Time: " %5.1f `dur' " seconds"

// Case 8: Customer Churn Prediction
display ""
display "Case 8: Customer Churn Prediction"
local start = clock(c(current_time), "hms")
capture noisily do "do/cases/case08_customer_churn_prediction.do"
local dur = (clock(c(current_time), "hms") - `start') / 1000
display "Done! Time: " %5.1f `dur' " seconds"

// Case 2: Customer Segmentation
display ""
display "Case 2: Customer Segmentation"
local start = clock(c(current_time), "hms")
capture noisily do "do/cases/case02_customer_segmentation.do"
local dur = (clock(c(current_time), "hms") - `start') / 1000
display "Done! Time: " %5.1f `dur' " seconds"

// Case 9: Product Portfolio Optimization
display ""
display "Case 9: Product Portfolio Optimization"
local start = clock(c(current_time), "hms")
capture noisily do "do/cases/case09_product_portfolio_optimization.do"
local dur = (clock(c(current_time), "hms") - `start') / 1000
display "Done! Time: " %5.1f `dur' " seconds"

// Case 3: Sales Forecasting
display ""
display "Case 3: Sales Forecasting"
local start = clock(c(current_time), "hms")
capture noisily do "do/cases/case03_sales_forecasting.do"
local dur = (clock(c(current_time), "hms") - `start') / 1000
display "Done! Time: " %5.1f `dur' " seconds"

// Summary
local total_dur = (clock(c(current_time), "hms") - `total_start') / 60
display ""
display "=" * 80
display "All cases completed! Total time: " %5.1f `total_dur' " minutes"
display "=" * 80
display ""
display "Course 2 (Data Prep): 1 case"
display "Course 3 (Regression): 2 cases"
display "Course 4 (Classification): 3 cases"
display "Course 5 (Clustering): 2 cases"
display "Comprehensive: 1 case"
display "Total: 9 cases"

